﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Orders.aspx.cs" Inherits="WebPages_Categories" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Orders</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <a href="../Default.aspx">Home</a><br /><br />    
    
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
            DataKeyNames="ID" DataSourceID="AccessDataSource1" 
            EmptyDataText="There are no data records to display." ForeColor="#333333" 
            GridLines="None" PageSize="5" Width="458px" 
            ondatabound="GridView1_DataBound" 
            onselectedindexchanged="GridView1_SelectedIndexChanged">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="ID" InsertVisible="False" />
                <asp:BoundField DataField="OrderDate" HeaderText="OrderDate" 
                    SortExpression="OrderDate" DataFormatString="{0:d}" />
                <asp:BoundField DataField="ShippedDate" HeaderText="ShippedDate" 
                    SortExpression="ShippedDate" DataFormatString="{0:d}" />
                <asp:BoundField DataField="ShipName" HeaderText="ShipName" 
                    SortExpression="ShipName" />
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <br />
        <asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" 
            DataSourceID="AccessDataSource2" Width="464px" CellPadding="4" 
            ForeColor="#333333">
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <EditItemTemplate>
                ID:
                <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                CustomerId:
                <asp:TextBox ID="CustomerIdTextBox" runat="server" 
                    Text='<%# Bind("CustomerId") %>' />
                <br />
                EmployeeID:
                <asp:TextBox ID="EmployeeIDTextBox" runat="server" 
                    Text='<%# Bind("EmployeeID") %>' />
                <br />
                OrderDate:
                <asp:TextBox ID="OrderDateTextBox" runat="server" 
                    Text='<%# Bind("OrderDate") %>' />
                <br />
                RequiredDate:
                <asp:TextBox ID="RequiredDateTextBox" runat="server" 
                    Text='<%# Bind("RequiredDate") %>' />
                <br />
                ShippedDate:
                <asp:TextBox ID="ShippedDateTextBox" runat="server" 
                    Text='<%# Bind("ShippedDate") %>' />
                <br />
                ShipperId:
                <asp:TextBox ID="ShipperIdTextBox" runat="server" 
                    Text='<%# Bind("ShipperId") %>' />
                <br />
                Freight:
                <asp:TextBox ID="FreightTextBox" runat="server" Text='<%# Bind("Freight") %>' />
                <br />
                ShipName:
                <asp:TextBox ID="ShipNameTextBox" runat="server" 
                    Text='<%# Bind("ShipName") %>' />
                <br />
                ShipAddress:
                <asp:TextBox ID="ShipAddressTextBox" runat="server" 
                    Text='<%# Bind("ShipAddress") %>' />
                <br />
                ShipCity:
                <asp:TextBox ID="ShipCityTextBox" runat="server" 
                    Text='<%# Bind("ShipCity") %>' />
                <br />
                ShipRegion:
                <asp:TextBox ID="ShipRegionTextBox" runat="server" 
                    Text='<%# Bind("ShipRegion") %>' />
                <br />
                ShipPostalCode:
                <asp:TextBox ID="ShipPostalCodeTextBox" runat="server" 
                    Text='<%# Bind("ShipPostalCode") %>' />
                <br />
                ShipCountry:
                <asp:TextBox ID="ShipCountryTextBox" runat="server" 
                    Text='<%# Bind("ShipCountry") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                CustomerId:
                <asp:TextBox ID="CustomerIdTextBox" runat="server" 
                    Text='<%# Bind("CustomerId") %>' />
                <br />
                EmployeeID:
                <asp:TextBox ID="EmployeeIDTextBox" runat="server" 
                    Text='<%# Bind("EmployeeID") %>' />
                <br />
                OrderDate:
                <asp:TextBox ID="OrderDateTextBox" runat="server" 
                    Text='<%# Bind("OrderDate") %>' />
                <br />
                RequiredDate:
                <asp:TextBox ID="RequiredDateTextBox" runat="server" 
                    Text='<%# Bind("RequiredDate") %>' />
                <br />
                ShippedDate:
                <asp:TextBox ID="ShippedDateTextBox" runat="server" 
                    Text='<%# Bind("ShippedDate") %>' />
                <br />
                ShipperId:
                <asp:TextBox ID="ShipperIdTextBox" runat="server" 
                    Text='<%# Bind("ShipperId") %>' />
                <br />
                Freight:
                <asp:TextBox ID="FreightTextBox" runat="server" Text='<%# Bind("Freight") %>' />
                <br />
                ShipName:
                <asp:TextBox ID="ShipNameTextBox" runat="server" 
                    Text='<%# Bind("ShipName") %>' />
                <br />
                ShipAddress:
                <asp:TextBox ID="ShipAddressTextBox" runat="server" 
                    Text='<%# Bind("ShipAddress") %>' />
                <br />
                ShipCity:
                <asp:TextBox ID="ShipCityTextBox" runat="server" 
                    Text='<%# Bind("ShipCity") %>' />
                <br />
                ShipRegion:
                <asp:TextBox ID="ShipRegionTextBox" runat="server" 
                    Text='<%# Bind("ShipRegion") %>' />
                <br />
                ShipPostalCode:
                <asp:TextBox ID="ShipPostalCodeTextBox" runat="server" 
                    Text='<%# Bind("ShipPostalCode") %>' />
                <br />
                ShipCountry:
                <asp:TextBox ID="ShipCountryTextBox" runat="server" 
                    Text='<%# Bind("ShipCountry") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                ID:
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                CustomerId:
                <asp:Label ID="CustomerIdLabel" runat="server" 
                    Text='<%# Bind("CustomerId") %>' />
                <br />
                EmployeeID:
                <asp:Label ID="EmployeeIDLabel" runat="server" 
                    Text='<%# Bind("EmployeeID") %>' />
                <br />
                OrderDate:
                <asp:Label ID="OrderDateLabel" runat="server" Text='<%# Bind("OrderDate") %>' />
                <br />
                RequiredDate:
                <asp:Label ID="RequiredDateLabel" runat="server" 
                    Text='<%# Bind("RequiredDate") %>' />
                <br />
                ShippedDate:
                <asp:Label ID="ShippedDateLabel" runat="server" 
                    Text='<%# Bind("ShippedDate") %>' />
                <br />
                ShipperId:
                <asp:Label ID="ShipperIdLabel" runat="server" Text='<%# Bind("ShipperId") %>' />
                <br />
                Freight:
                <asp:Label ID="FreightLabel" runat="server" Text='<%# Bind("Freight") %>' />
                <br />
                ShipName:
                <asp:Label ID="ShipNameLabel" runat="server" Text='<%# Bind("ShipName") %>' />
                <br />
                ShipAddress:
                <asp:Label ID="ShipAddressLabel" runat="server" 
                    Text='<%# Bind("ShipAddress") %>' />
                <br />
                ShipCity:
                <asp:Label ID="ShipCityLabel" runat="server" Text='<%# Bind("ShipCity") %>' />
                <br />
                ShipRegion:
                <asp:Label ID="ShipRegionLabel" runat="server" 
                    Text='<%# Bind("ShipRegion") %>' />
                <br />
                ShipPostalCode:
                <asp:Label ID="ShipPostalCodeLabel" runat="server" 
                    Text='<%# Bind("ShipPostalCode") %>' />
                <br />
                ShipCountry:
                <asp:Label ID="ShipCountryLabel" runat="server" 
                    Text='<%# Bind("ShipCountry") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Edit" />
                &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="Delete" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="New" />
            </ItemTemplate>
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        </asp:FormView>
        <br />
        <asp:GridView ID="GridView2" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ID" 
            DataSourceID="AccessDataSource3" ForeColor="#333333" GridLines="None">
            <RowStyle BackColor="#E3EAEB" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowSelectButton="True" />
                <asp:BoundField DataField="ID" HeaderText="ID" 
                    SortExpression="ID" InsertVisible="False" ReadOnly="True" />
                <asp:BoundField DataField="OrderID" HeaderText="OrderID" 
                    SortExpression="OrderID" />
                <asp:BoundField DataField="ProductID" HeaderText="ProductID" 
                    SortExpression="ProductID" />
                <asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" 
                    SortExpression="UnitPrice" />
                <asp:BoundField DataField="Quantity" HeaderText="Quantity" 
                    SortExpression="Quantity" />
                <asp:BoundField DataField="Discount" HeaderText="Discount" 
                    SortExpression="Discount" />
            </Columns>
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#7C6F57" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/NorthwindNET.mdb" 
            
            SelectCommand="SELECT [ID], [OrderDate], [ShippedDate], [ShipName] FROM [Order]">
        </asp:AccessDataSource>
    
    </div>
        <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
            DataFile="~/App_Data/NorthwindNET.mdb" 
            DeleteCommand="DELETE FROM [Order] WHERE [ID] = ?" 
            InsertCommand="INSERT INTO [Order] ([ID], [CustomerId], [EmployeeID], [OrderDate], [RequiredDate], [ShippedDate], [ShipperId], [Freight], [ShipName], [ShipAddress], [ShipCity], [ShipRegion], [ShipPostalCode], [ShipCountry]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" 
            SelectCommand="SELECT [ID], [CustomerId], [EmployeeID], [OrderDate], [RequiredDate], [ShippedDate], [ShipperId], [Freight], [ShipName], [ShipAddress], [ShipCity], [ShipRegion], [ShipPostalCode], [ShipCountry] FROM [Order] WHERE ([ID] = ?)" 
            
            UpdateCommand="UPDATE [Order] SET [CustomerId] = ?, [EmployeeID] = ?, [OrderDate] = ?, [RequiredDate] = ?, [ShippedDate] = ?, [ShipperId] = ?, [Freight] = ?, [ShipName] = ?, [ShipAddress] = ?, [ShipCity] = ?, [ShipRegion] = ?, [ShipPostalCode] = ?, [ShipCountry] = ? WHERE [ID] = ?">
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="ID" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="CustomerId" Type="Int32" />
                <asp:Parameter Name="EmployeeID" Type="Int32" />
                <asp:Parameter Name="OrderDate" Type="DateTime" />
                <asp:Parameter Name="RequiredDate" Type="DateTime" />
                <asp:Parameter Name="ShippedDate" Type="DateTime" />
                <asp:Parameter Name="ShipperId" Type="Int32" />
                <asp:Parameter Name="Freight" Type="Decimal" />
                <asp:Parameter Name="ShipName" Type="String" />
                <asp:Parameter Name="ShipAddress" Type="String" />
                <asp:Parameter Name="ShipCity" Type="String" />
                <asp:Parameter Name="ShipRegion" Type="String" />
                <asp:Parameter Name="ShipPostalCode" Type="String" />
                <asp:Parameter Name="ShipCountry" Type="String" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:Parameter Name="CustomerId" Type="Int32" />
                <asp:Parameter Name="EmployeeID" Type="Int32" />
                <asp:Parameter Name="OrderDate" Type="DateTime" />
                <asp:Parameter Name="RequiredDate" Type="DateTime" />
                <asp:Parameter Name="ShippedDate" Type="DateTime" />
                <asp:Parameter Name="ShipperId" Type="Int32" />
                <asp:Parameter Name="Freight" Type="Decimal" />
                <asp:Parameter Name="ShipName" Type="String" />
                <asp:Parameter Name="ShipAddress" Type="String" />
                <asp:Parameter Name="ShipCity" Type="String" />
                <asp:Parameter Name="ShipRegion" Type="String" />
                <asp:Parameter Name="ShipPostalCode" Type="String" />
                <asp:Parameter Name="ShipCountry" Type="String" />
            </InsertParameters>
        </asp:AccessDataSource>
        <asp:AccessDataSource ID="AccessDataSource3" runat="server" 
            DataFile="~/App_Data/NorthwindNET.mdb" 
            DeleteCommand="DELETE FROM [OrderDetail] WHERE [ID] = ?" 
            InsertCommand="INSERT INTO [OrderDetail] ([ID], [OrderID], [ProductID], [UnitPrice], [Quantity], [Discount]) VALUES (?, ?, ?, ?, ?, ?)" 
            SelectCommand="SELECT [ID], [OrderID], [ProductID], [UnitPrice], [Quantity], [Discount] FROM [OrderDetail] WHERE ([OrderID] = ?)" 
            
            
            UpdateCommand="UPDATE [OrderDetail] SET [OrderID] = ?, [ProductID] = ?, [UnitPrice] = ?, [Quantity] = ?, [Discount] = ? WHERE [ID] = ?">
            <SelectParameters>
                <asp:ControlParameter ControlID="FormView1" Name="OrderID" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="OrderID" Type="Int32" />
                <asp:Parameter Name="ProductID" Type="Int32" />
                <asp:Parameter Name="UnitPrice" Type="Decimal" />
                <asp:Parameter Name="Quantity" Type="Int16" />
                <asp:Parameter Name="Discount" Type="Single" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:Parameter Name="OrderID" Type="Int32" />
                <asp:Parameter Name="ProductID" Type="Int32" />
                <asp:Parameter Name="UnitPrice" Type="Decimal" />
                <asp:Parameter Name="Quantity" Type="Int16" />
                <asp:Parameter Name="Discount" Type="Single" />
            </InsertParameters>
        </asp:AccessDataSource>
    </form>
</body>
</html>
